﻿using System;
using System.Threading;

namespace eLoop;

sealed class InlineScheduler : ITaskScheduler
{
    public string Id => "inline:0";
    public int ThreadId => -1;
    public string Name => "inline";

    public long RefCount => 0;
    public bool IsDisposed => false;
    public bool IsEquals(ITaskScheduler scheduler) => Scheduler.Equals(scheduler, this);
    public void Reference() { }
    public void Unreference() { }
    public void Schedule(IRunnable runnable, object o) => runnable.Execute(o);
    public unsafe void Schedule(delegate*<object, void> action, object o) => action(o);
    public void Schedule(IThreadPoolExecutor executor) => executor.Execute();
    public void Schedule0(WaitCallback callback, object o) => callback(o);
    public void Schedule1(Action<object> callback, object o) => callback(o);
    public void Dispose() { }
}
